/*!
 * 面板控件.
 * ecp.qzz.ui.design.image.js
 * 创建：QZZ
 * 日期：2014-03-01
 */
define(["qzz.dbase"], function() {
	
	var qzz = window.qzz;
	qzz.space("ui.design");
	/**
	 * 面板控件.
	 */
	qzz.ui.design.image = qzz.Class(qzz.ui.design.base, {
		/**
		 * 创建函数
		 */
	    _create:function() {
	    	this.base();
            this.className = "Image";
            if(this.getOption().src == null) {
            	this.getOption().src = "";
            }
	    },
	    /**
	     * 渲染.
	     */
	    _render:function() {
	    	this.base();
	    	this._image = this.createElement("IMG");
	    	this._image.style.width = "100%";
	    	this._image.style.height = "100%";
	    	this.thisWindow.appendChild(this._image);
	    },
	    getAttribute:function() {
	    	var attr = this.base();
	    	if(this.parent.tagName == "TD" || this.parent[0] != null && this.parent[0].tagName) {
	    		attr.splice(attr.length - 1, 1);
	    	}
	    	attr.push({"name":"src","value":this.getOption().src});
	    	attr.push({"name":"dataField","value":this.getOption().dataField});
	    	return attr;
	    },
	    refresh:function() {
	    	this.base();
	    	this._image.src = this.getOption().src;
	    	if(this.getOption().transparent === false) {
	    		this.thisWindow.style.backgroundColor = "#FFFFFF";
	    	} else {
	    		this.thisWindow.style.backgroundColor = "";
	    	}
	    },
	    setScr:function(url) {
	    	this.getOption().src = url;
	    	this.refresh();
	    }
	});
	
	/**
	 * 图片控件.
	 */
	_bindRenderFunc("qzzimage", qzz.ui.design.image);
	return qzz.ui.design.image;
});